<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ include file="../common/tags.jsp" %>  
<%String path = request.getContextPath();%>
<form id="pagerForm" method="post" action="<%=path %>/roles/listRoles.action">
	<input type="hidden" name="pageRequest" value="1" />
	<input type="hidden" name="pageNum" value="${paginator.pageIndex}" />
	<input type="hidden" name="numPerPage" value="${paginator.pageSize}" />
</form>

<div class="pageHeader">
	<form onsubmit="return navTabSearch(this);" rel="pagerForm" action="<%=path %>/roles/listRoles.action" method="post">
	<div class="searchBar">
		<ul class="searchContent">
			<li>
				<label style="text-align: right;">角色名称：</label>
				<input name="rolesVO.name" value="<s:property value="rolesVO.name" />" type="text"/>
			</li>
			<li>
				<label style="text-align: right;">角色类型：</label>
				<select name="rolesVO.roleType" class="combox">
					<option value="">选择角色类型</option>
					<c:forEach var="item" items="${roleTypes}">
						<c:if test="${SESSION_USER.customer ==null}">
							<option value="${item.name}" ${rolesVO.roleType eq item.name?"selected":"" }>${item.title}</option>
						</c:if>
						<c:if test="${SESSION_USER.customer !=null && item.name != 'SUPPER'}">
							<option value="${item.name}" ${rolesVO.roleType eq item.name?"selected":"" }>${item.title}</option>
						</c:if>
					</c:forEach>
				</select>
			</li>
			<c:if test="${SESSION_USER.customer != null}">
				<input name="rolesVO.customerId" value="${SESSION_USER.customer.id}" type="hidden">
			</c:if>
			<c:if test="${SESSION_USER.customer == null}">
				<li>
					<label style="text-align: right;">所属商家：</label>
					<input name="rolesVO.customerId" value="<s:property value="rolesVO.customerId" />" type="hidden">
					<input onclick="$('#rolesList_a_btnLook').trigger('click');" style="cursor: pointer;float: left;" name="rolesVO.customerName" value="<s:property value="rolesVO.customerName" />" >
					<!--  <a class="btnLook" id="rolesList_a_btnLook" href="<%=path %>/customer/listCustomer.action?searchType=active" lookupGroup="rolesVO">选择</a>-->
				</li>
			</c:if>
		</ul>
		<ul class="searchContent">
			<li style="width:450px">
				<label style="text-align: right;">创建时间：</label>
				从<input type="text" name="rolesVO.gtcreateDate" value='<s:date name='rolesVO.gtcreateDate' format="yyyy-MM-dd HH:mm:ss"/>'  dateFmt="yyyy-MM-dd HH:mm:ss" class="date" readonly="false" size="19"/>
				到<input type="text" name="rolesVO.ltcreateDate" value='<s:date name='rolesVO.ltcreateDate' format="yyyy-MM-dd HH:mm:ss"/>'  dateFmt="yyyy-MM-dd HH:mm:ss" class="date" readonly="false" size="19"/>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<shiro:hasPermission name="addRoles">
			<li><a class="add" href="<%=path %>/roles/addRoles.action" target="navTab"><span>添加</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="deleteRoles">
			<li><a title="确实要删除这些记录吗?" target="selectedTodo" rel="ids" postType="string" href="<%=path %>/roles/deleteRoles.action" class="delete"><span>删除</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="editRoles">
			<li><a class="edit" href="<%=path %>/roles/editRoles.action?rolesVO.id={sid_user}" target="navTab" warn="请选择一条记录"><span>修改</span></a></li>
			</shiro:hasPermission>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="164">
		<thead>
			<tr>
				<th width="30"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th>角色名称</th>
				<th>角色类型</th>
				<th>创建日期</th>
				<th>创建人</th>
				<th>所属商家</th>
				<th>说明</th>
				<th width="70">操作</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="rolesList" id="roles" status="st">
				<tr target="sid_user" rel="<s:property value="id" />">
					<td><input name="ids" value="<s:property value="id" />" type="checkbox"></td>
             <td><s:property value="name" /></td>	
             <td><s:property value="roleTypeTitle" /></td>	
	<td><s:date name="createDate" format="yyyy-MM-dd" /></td>
             <td><s:property value="creator.name" /></td>
             <td><s:property value="customer.name" /></td>
             <td><s:property value="description" /></td>	
					<td>
						<shiro:hasPermission name="deleteRoles">
						<a title="确实要删除这条记录吗?" target="ajaxTodo" href="<%=path %>/roles/deleteRoles.action?ids=<s:property value="id" />" class="btnDel">删除</a>
						</shiro:hasPermission>
						<shiro:hasPermission name="editRoles">
						<a title="编辑" target="navTab" href="<%=path %>/roles/editRoles.action?rolesVO.id=<s:property value="id" />" class="btnEdit">编辑</a>
						</shiro:hasPermission>
					</td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
				<span>显示</span>
				<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
					<option value="15" <c:if test="${paginator.pageSize==15}">selected='selected'</c:if> >15</option>
					<option value="30" <c:if test="${paginator.pageSize==30}">selected='selected'</c:if> >30</option>
					<option value="50" <c:if test="${paginator.pageSize==50}">selected='selected'</c:if> >50</option>
					<option value="100" <c:if test="${paginator.pageSize==100}">selected='selected'</c:if> >100</option>
					<option value="200" <c:if test="${paginator.pageSize==200}">selected='selected'</c:if> >200</option>
				</select>
				<span>条，共${paginator.totalCount}条</span>
			</div>
			<div class="pagination" targetType="navTab" totalCount="${paginator.totalCount}" 
				numPerPage="${paginator.pageSize}" pageNumShown="10" currentPage="${paginator.pageIndex}"></div>
	</div>
</div>